
import { Space, Table, Tag } from 'antd';
import type { TableProps } from 'antd';
import { ListApi } from '../../api/user';
import { useEffect, useState } from 'react';
function Index() {
    const [list,setList]=useState([])
    const getData=async()=>{
        const res=await ListApi()
        console.log(res.rows);
        setList(res.rows)  
    }
    useEffect(()=>{
        getData()
    },[])
    interface DataType {
        key: string;
        name: string;
        age: number;
        address: string;
        tags: string[];
    }

    const columns: TableProps<DataType>['columns'] = [
        {
            title: 'id',
            dataIndex: 'id',
            key: 'id',
            render: (text) => <a>{text}</a>,
        },
        {
            title: 'content',
            dataIndex: 'content',
            key: 'content',
        },
        {
            title: 'title',
            dataIndex: 'title',
            key: 'title',
        },
        {
            title: 'createdAt',
            dataIndex: 'createdAt',
            key: 'createdAt',
        },
        {
            title: 'Action',
            key: 'action',
            render: (_, record) => (
                <Space size="middle">
                    <a>Invite {record.name}</a>
                    <a>Delete</a>
                </Space>
            ),
        },
    ];

   
    return (
        <div>
            <Table<DataType> columns={columns} dataSource={list} />
        </div>
    )
}

export default Index
